#pragma once

#include "DbConnection.h"

namespace Sapphire::Db
{
  class DbConnectionInfo;

  enum ZoneDbStatements : uint32_t
  {
    CHARA_SEL,
    CHARA_SEL_MINIMAL,
    CHARA_SEL_SEARCHINFO,
    CHARA_SEL_QUEST,
    CHARA_INS,
    CHARA_UP,
    CHARA_UP_NAME,
    CHARA_UP_HPMP,
    CHARA_UP_MODE,
    CHARA_UP_MOUNT,
    CHARA_UP_INVINCIBLE,
    CHARA_UP_CUSTOMIZE,
    CHARA_UP_MODELMAINWEAP,
    CHARA_UP_MODELSUBWEAP,
    CHARA_UP_MODELSYSWEAP,
    CHARA_UP_MODELEQUIP,
    CHARA_UP_EMOTEMODETYPE,
    CHARA_UP_FIRSTLOGINTIME,
    CHARA_UP_LANGUAGE,
    CHARA_UP_ISNEWGAME,
    CHARA_UP_ISNEWADV,
    CHARA_UP_TERRITORY,
    CHARA_UP_POS,
    CHARA_UP_CLASS,
    CHARA_UP_STATUS,
    CHARA_UP_TOTALPLAYTIME,
    CHARA_UP_HOMEPOINT,
    CHARA_UP_FAVOPOINT,
    CHARA_UP_TITLE,
    CHARA_UP_TITLELIST,
    CHARA_UP_AETHERYTE,
    CHARA_UP_HOWTO,
    CHARA_UP_MINIONS,
    CHARA_UP_MOUNTS,
    CHARA_UP_GEARSET,
    CHARA_UP_CONFIGFLAGS,
    CHARA_UP_QUESTCOMPLETE,
    CHARA_UP_OPENINGSEQ,
    CHARA_UP_QUESTTRACKING,
    CHARA_UP_GRANDCOMPANY,
    CHARA_UP_GRANDCOMPANYRANKS,
    CHARA_UP_DISCOVERY,
    CHARA_UP_GMRANK,
    CHARA_UP_EQUIPDISPLAYFLAGS,
    CHARA_UP_UNLOCKS,
    CHARA_UP_CFPENATLY,
    CHARA_SEARCHINFO_INS,
    CHARA_SEARCHINFO_UP_SELECTCLASS,
    CHARA_SEARCHINFO_UP_SELECTREGION,
    CHARA_SEARCHINFO_UP_SEARCHCOMMENT,

    CHARA_QUEST_INS,
    CHARA_QUEST_UP,
    CHARA_QUEST_DEL,

    CHARA_CLASS_SEL,
    CHARA_CLASS_INS,
    CHARA_CLASS_UP,
    CHARA_CLASS_DEL,

    CHARA_ITEMINV_INS,
    CHARA_CURRENCYINV_INS,

    CHARA_ITEMGLOBAL_SELECT,
    CHARA_ITEMGLOBAL_INS,
    CHARA_ITEMGLOBAL_UP,
    CHARA_ITEMGLOBAL_DELETE,

    CHARA_MONSTERNOTE_INS,
    CHARA_MONSTERNOTE_UP,
    CHARA_MONSTERNOTE_SEL,

    CHARA_FRIENDLIST_INS,
    CHARA_FRIENDLIST_UP,
    CHARA_FRIENDLIST_SEL,

    CHARA_BLACKLIST_INS,
    CHARA_BLACKLIST_UP,
    CHARA_BLACKLIST_SEL,

    CHARA_ACHIEV_INS,
    CHARA_ACHIEV_UP,
    CHARA_ACHIEV_SEL,

    CHARA_LINKSHELL_INS,

    ZONE_SEL_BNPCS,
    ZONE_SEL_BNPCS_BY_TERI,

    LAND_INS,
    LAND_SEL,
    LAND_SEL_ALL,
    LAND_UP,
    LANDSET_SEL,
    HOUSING_HOUSE_INS,
    HOUSING_HOUSE_UP,
    HOUSING_HOUSE_DEL,

    LAND_INV_SEL_ALL,
    LAND_INV_SEL_HOUSE,
    LAND_INV_DEL,
    LAND_INV_UP,
    LAND_INV_UP_ITEMPOS,
    LAND_INV_DEL_ITEMPOS,

    LINKSHELL_SEL_ALL,
    LINKSHELL_INS,
    LINKSHELL_UP,
    LINKSHELL_DEL,

    FC_SEL_ALL,
    FC_INS,
    FC_UP,
    FC_DEL,

    FC_MEMBERS_SEL_ALL,
    FC_MEMBERS_SEL_FC,
    FC_MEMBERS_INS,
    FC_MEMBERS_UP,
    FC_MEMBERS_DEL,

    MAX_STATEMENTS
  };

  class ZoneDbConnection : public DbConnection
  {
  public:
    using Statements = ZoneDbStatements;

    ZoneDbConnection( ConnectionInfo& connInfo );

    ZoneDbConnection( Common::Util::LockedWaitQueue< std::shared_ptr< Operation > >* q, ConnectionInfo& connInfo );

    ~ZoneDbConnection();

    void doPrepareStatements() override;

  };

}
